package com.maimao.model.order.es;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.maimao.model.order.OrderGoods;
import com.maimao.model.order.OrderShop;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author MaoLin Wang
 * @date 2021/3/29 9:44 下午
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class EsOrder implements Serializable {
    public static final String USER_ID = "userId";
    private static final long serialVersionUID = -4021700330345745891L;

    public static final String FIELD_STATUS = "status";

    public static final String FIELD_CREATE_TIME = "createTime";

    public static final String FIELD_ORDER_SHOP_LIST = "orderShopList";

    public static final String DELETED = "deleted";

    public static final String ID = "id";

    /**
     * orderShop字段嵌套查询的path
     */
    public static final String ORDER_SHOP_NESTED_PATH = "orderShopList";

    /**
     * orderGoods字段嵌套查询的path
     */
    public static final String ORDER_GOODS_NESTED_PATH = "orderShopList.orderGoodsList";


    /**
     * 订单id
     */
    private String id;

    /**
     * 用户id
     */
    private String userId;

    /**
     * 收货人
     */
    private String consignee;

    private String mobile;

    /**
     * 系统优惠券id
     */
    @TableField("sys_coupon_id")
    private String sysCouponId;

    /**
     * 积分总减免
     */
    private BigDecimal integral;

    /**
     * 是否使用了积分
     */
    private Boolean useIntegral;

    /**
     * 支付code
     */
    private String payCode;

    /**
     * 支付时间
     */
    private LocalDateTime payTime;

    private LocalDateTime createTime;

    /**
     * 订单取消时间
     */
    private LocalDateTime closeTime;

    /**
     * 订单状态(1-已提交-待付款，2-已付款-待发货， 3 -交易成功，4-交易取消 )
     */
    private Integer status;

    private Boolean deleted;

    /**
     * 1 普通 2 秒杀
     */
    private Integer type;

    private List<EsOrderShop> orderShopList;

    @Override
    public String toString() {
        return "EsOrder{" +
                "id='" + id + '\'' +
                ", userId='" + userId + '\'' +
                ", consignee='" + consignee + '\'' +
                ", mobile='" + mobile + '\'' +
                ", sysCouponId='" + sysCouponId + '\'' +
                ", integral=" + integral +
                ", useIntegral=" + useIntegral +
                ", payCode='" + payCode + '\'' +
                ", payTime=" + payTime +
                ", createTime=" + createTime +
                ", closeTime=" + closeTime +
                ", status=" + status +
                ", deleted=" + deleted +
                ", type=" + type +
                ", orderShopList=" + orderShopList +
                '}';
    }
}
